﻿<%@ Page Language="C#" Inherits="E.Web.Teacher.internals.score.Edit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
  <title>成绩类别信息</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  <link rel="stylesheet" href="/css/main.css" type="text/css" media="all" />
  <link rel="stylesheet" href="/css/t_main.css" type="text/css" media="all" />
  <script type="text/javascript" src="/js/ajax.js"></script>
  <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
  <script type="text/javascript">
    function CheckForm() {
      var name = document.getElementById("NameTxt").value;
      var chkcategoryname = $("#chkcategorynamerst").val();
      if (chkcategoryname == "1") {
        alert("请检查类别名称是否存在");
        return false;
      } else {
        if (name == "") {
          alert("请正确填写信息");
          return false;
        } else {
          return true;
        }
      }
    }

    function CheckCategoryName() {
      var v = document.getElementById("NameTxt").value;
      var act = document.getElementById("act").value;
      if (v != "") {
        if (act == "n") {
          ajaxRead("/tools/ajax.aspx?t=chkScoreCategoryName&v=" + escape(v) + "&id=-1", "GetSetRst(obj);");
        } else {
          var id = document.getElementById("id").value;
          ajaxRead("/tools/ajax.aspx?t=chkScoreCategoryName&v=" + escape(v) + "&id=" + id, "GetSetRst(obj);");
        }
      }
    }

    function GetSetRst(obj) {
      var res = obj.getElementsByTagName('result');
      var rst;
      if (res[0] != null && res[0] != undefined) {
        if (res[0].childNodes.length > 1) {
          rst = res[0].childNodes[1].nodeValue;
        } else {
          rst = res[0].firstChild.nodeValue;
        }
      }
      if (rst == "1") {
        $("#chkCategoryNameRst").html("该类别名称已存在，请更换");
        $("#chkcategorynamerst").val("1");
        document.getElementById("NameTxt").focus();
      } else {
        $("#chkCategoryNameRst").html("该类别名称未使用");
        $("#chkcategorynamerst").val("0");
      }
    }
  </script>
</head>
<body>
  <form id="form1" action="" method="post">
    <div class="m_top"></div>
    <div class="block_2">
      <div style="width:650px; height:22px;">
        <div class="title">&nbsp;成绩类别信息</div>
      </div>
      <div class="spe_line_2"></div>
      <div class="box_1">
        <div class="fl tr left">类别名称：</div>
        <div class="fl dis_r"><input type="text" id="NameTxt" name="NameTxt" value="<%=name %>" style="width:200px;" /></div>
        <div class="fl" style="line-height:20px; _line-height:23px;">&nbsp;<span class="hint" id="chkCategoryNameRst"></span></div>
      </div>
      <div class="box_1">
        <div class="fl tr left">&nbsp;</div>
        <div class="fl dis_r"><a href="javascript:CheckCategoryName();">检查类别名称是否存在</a></div>
      </div>
    </div>
    <div class="block">
      <div style="width:350px; margin-top:20px; text-align:center;">
        <input type="image" src="/images/btn/confirm.gif" style="width:52px; height:22px;" onclick="return CheckForm();" />
        &nbsp;&nbsp;<a href="/internals/score/List.aspx"><img alt="" src="/images/btn/back.gif" /></a>
      </div>
    </div>
      <input type="hidden" id="chkcategorynamerst" name="chkcategorynamerst" value="1" />
      <input type="hidden" id="act" name="act" value="<%=act %>" />
      <input type="hidden" id="id" name="id" value="<%=id %>" />
  </form>
</body>
</html>
